package com.huyanqi.front.rest.resource.impl;

import java.util.List;

import javax.annotation.Resource;

import com.huyanqi.core.RetdObj;
import com.huyanqi.entity.Shopactivity;
import com.huyanqi.front.rest.RespCode;
import com.huyanqi.front.rest.resource.ShopactivityListResource;
import com.huyanqi.front.rest.resp.ShopactivityListResp;
import com.huyanqi.front.rest.service.ShopactivityRestService;

public class ShopactivityResourceImpl implements ShopactivityListResource{

	private ShopactivityRestService restService;
	
	@Resource(name="ShopactivityRestService")
	public void setRestService(ShopactivityRestService restService) {
		this.restService = restService;
	}
	public ShopactivityRestService getRestService() {
		return restService;
	}
	
	@Override
	public ShopactivityListResp findShopActivityBySid(Long shopid) {
		ShopactivityListResp slp = new ShopactivityListResp();
		try{
			RetdObj<List<Shopactivity>> retd = restService.findShopActivityBySid(shopid);
			slp.setCode(RespCode.valueOf(retd.getCode()));
			slp.setData(retd.getRealObj());
		}catch (Exception e) {
			e.printStackTrace();
			slp.setCode(RespCode.EX_APP);
		}
		return slp;
	}
	
}